package booksys.book;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BookDao {

//    @Select("select * from book ")
    List<Book> findBookList(QueryDto queryDto);


    @Insert("insert book(b_id,b_name,b_writer,b_keywords) values(#{b_id},#{b_name},#{b_writer},#{b_keywords})")
    void insertBook(BookDto dto);


    @Select("select count(*) from book where b_id = #{b_id}")
    boolean findBookbyId(String b_id);

    @Select("select count(*) from bookborrow where bb_id=#{b_id} and bb_retime is NULL")
    boolean getbb_retime(String b_id);

    @Update("update book set b_name=#{b_name},b_writer=#{b_writer},b_keywords=#{b_keywords} where b_id=#{b_id} ")
    void updateBook(BookDto dto);


    @Delete("delete from book where b_id=#{b_id}")
    void deleteBook(String b_id);
}
